package com.gof.example.simplefactory;

/**
 * Created with IntelliJ IDEA.
 * Created by zhiyuan on 2018/4/30 10:08.
 * haiming.fei@tongdun.cn
 */
public abstract class Car {

    public static <T extends Car> T createCar(Class<T> cls) {
        try {
            return cls.newInstance();
        } catch (InstantiationException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        }
        return null;
    }

    public abstract void run();
}
